<template>
  <div v-if="this.totalList.length===0">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="位置" prop="location">
        <el-input
          v-model="queryParams.location"
          placeholder="位置"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="totalList"   :header-cell-class-name="addClass" >
      <el-table-column label="编号"  align="center"  prop="testId"  fixed/>
      <el-table-column label="被试名"  align="center"  prop="name"  fixed/>

      <el-table-column label="测试地点" align="center" prop="location" fixed/>


      <el-table-column label="上传时间" align="center" prop="date" min-width="100"/>

      <el-table-column label="SCDS分数" align="center" prop="scds" min-width="100">

      </el-table-column>
      <el-table-column label="MMSE_directive分数" align="center" prop="mmse" min-width="100">

      </el-table-column>
      <el-table-column label="MMSE_memory分数" align="center" prop="mmse" min-width="100">

      </el-table-column>
      <el-table-column label="MMSE_attention分数" align="center" prop="mmse" min-width="100">

      </el-table-column>
      <el-table-column label="MMSE_recall分数" align="center" prop="mmse" min-width="100">

      </el-table-column>
      <el-table-column label="MMSE_language分数" align="center" prop="mmse" min-width="100">

      </el-table-column>

      <el-table-column label="MOCA1分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA2分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA3分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA4分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA5分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA6分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA7分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="MOCA8分数" align="center" prop="moca" min-width="100">

      </el-table-column>
      <el-table-column label="CDT分数" align="center" prop="cdt" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_1分数" align="center" prop="avlt1" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_2分数" align="center" prop="avlt2" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_3分数" align="center" prop="avlt3" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_4分数" align="center" prop="avlt4" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_5分数" align="center" prop="avlt5" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_6分数" align="center" prop="avlt6" min-width="100">

      </el-table-column>
      <el-table-column label="AVLT_7分数" align="center" prop="avlt7" min-width="100">

      </el-table-column>
      <el-table-column label="TMT_1A分数" align="center" prop="tmt1a" min-width="100">

      </el-table-column>
      <el-table-column label="TMT_1B分数" align="center" prop="tmt1b" min-width="100">

      </el-table-column>
      <el-table-column label="TMT_2A分数" align="center" prop="tmt2a" min-width="100">

      </el-table-column>
      <el-table-column label="TMT_2B分数" align="center" prop="tmt2b" min-width="100">

      </el-table-column>
      <el-table-column label="DST1分数" align="center" prop="dst1" min-width="100">

      </el-table-column>
      <el-table-column label="DST2分数" align="center" prop="dst2" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_A1分数" align="center" prop="vftA1" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_A2分数" align="center" prop="vftA2" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_B1分数" align="center" prop="vftB1" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_B2分数" align="center" prop="vftB2" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_C1分数" align="center" prop="vftC1" min-width="100">

      </el-table-column>
      <el-table-column label="VFT_C2分数" align="center" prop="vftC2" min-width="100">

      </el-table-column>
      <el-table-column label="HAMD分数" align="center" prop="hamd" min-width="100">

      </el-table-column>
      <el-table-column label="HAMA分数" align="center" prop="hama" min-width="100">

      </el-table-column>
      <el-table-column label="ADL分数" align="center" prop="adl" min-width="100">

      </el-table-column>
      <el-table-column label="PSQI分数" align="center" prop="psqi" min-width="100">

      </el-table-column>
      <el-table-column label="NPI1分数" align="center" prop="npi1" min-width="100">

      </el-table-column>

      <el-table-column label="NPI2分数" align="center" prop="npi2" min-width="100">

      </el-table-column>
      <el-table-column label="AQD1分数" align="center" prop="aqd1" min-width="100">

      </el-table-column>
      <el-table-column label="AQD2分数" align="center" prop="aqd2" min-width="100">

      </el-table-column>

      <el-table-column label="HIS分数" align="center" prop="his" min-width="100">

      </el-table-column>
      <el-table-column label="GDS分数" align="center" prop="gds" min-width="100">

      </el-table-column>
      <el-table-column label="CFT分数" align="center" prop="CFT" min-width="100">

      </el-table-column>
      <el-table-column label="CDR分数" align="center" prop="cdr" min-width="100">

      </el-table-column>
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" :width="140" >
      </el-table-column>
      <el-table-column label="量表确认" align="center" fixed="right" class-name="small-padding fixed-width" :width="120" >

      </el-table-column>
      <el-table-column label="编号确认" align="center" fixed="right" class-name="small-padding fixed-width" :width="120" >

      </el-table-column>
    </el-table>
  </div>
  <div v-else style="margin-left: 10px">
    <div>
      <el-row :gutter="10" class="mb8" style="height: 30px; margin-top:10px; margin-bottom: 30px">
        <el-col :span="21">
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" style="height: 40px; margin-top:10px; margin-bottom: 0px">
            <el-form-item label="姓名" prop="name">
              <el-input
                v-model="queryParams.name"
                placeholder="姓名"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="位置" prop="location">
              <el-input
                v-model="queryParams.location"
                placeholder="位置"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-form>
        </el-col>
        <el-col :span="1.5" style="height: 40px; margin-top:10px; margin-bottom: 0px; margin-left: 10px">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
          >全部导出</el-button>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" style="height: 40px; margin-top:10px; margin-bottom: 0px"></right-toolbar>
      </el-row>
    </div>

    <div class="table-container" id="aTable" style="margin-top: 20px">
      <!--        <el-table v-loading="loading" :data="totalList"  :cell-style="cellStyle" :header-cell-class-name="addClass" @selection-change="handleSelectionChange">-->
      <!--        <el-table v-loading="loading" :data="totalList"  :cell-style="cellStyle" :header-cell-class-name="addClass" @selection-change="handleSelectionChange">-->
      <el-table v-loading="loading" :data="totalList" :header-cell-class-name="addClass" @selection-change="handleSelectionChange" max-height="700px" cell-style="padding-top:8px; padding-bottom:5px">
        <!--          <el-table-column type="selection" width="55" align="center" />-->
        <el-table-column label="编号"  align="center"  prop="testId"  fixed width="120">
          <template slot-scope="scope">
            <span v-if="scope.row.testId !== null" class="bbb" >{{ scope.row.testId }}</span>
            <span v-else class="aaa">暂无数据</span>
          </template>
        </el-table-column>

        <el-table-column label="被试名"  align="center"  prop="name"  fixed>
          <template slot-scope="scope">
            <span v-if="scope.row.name !== null" class="bbb">{{ scope.row.name }}</span>
            <span v-else class="aaa">暂无数据</span>
          </template>
        </el-table-column>
        <el-table-column label="测试地点" align="center" prop="location" fixed width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.location !== null" class="bbb">{{ scope.row.location }}</span>
            <span v-else class="aaa">暂无数据</span>
          </template>
        </el-table-column>
        <el-table-column label="上传时间" align="center" prop="date" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.date !== null" class="bbb">{{ scope.row.date }}</span>
            <span v-else class="aaa">暂无数据</span>
          </template>
        </el-table-column>
        <el-table-column label="SCDS分数" align="center" prop="scds" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.scds !== null" class="bbb">{{ scope.row.scds }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <!--          <el-table-column label="MMSE_directive分数" align="center" prop="mmseDirective" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmseDirective !== null" class="bbb">{{ scope.row.mmseDirective }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MMSE_memory分数" align="center" prop="mmseMemory" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmseMemory !== null" class="bbb">{{ scope.row.mmseMemory }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MMSE_attention分数" align="center" prop="mmseAttention" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmseAttention !== null" class="bbb">{{ scope.row.mmseAttention }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MMSE_recall分数" align="center" prop="mmseRecall" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmseRecall !== null" class="bbb">{{ scope.row.mmseRecall }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MMSE_language分数" align="center" prop="mmseLanguage" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmseLanguage !== null" class="bbb">{{ scope.row.mmseLanguage }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MMSE总分" align="center" prop="mmse" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.mmse !== null" class="bbb">{{ scope.row.mmse }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->


        <el-table-column label="MMSE总分" align="center" prop="mmse" min-width="100">
          <template slot-scope="scope">
            <template v-if="scope.row.mmse !== null">
              <!-- 使用 el-popover 包裹住 mmse 的值 -->
              <el-popover
                trigger="hover"
                placement="top-start"
                width="200"
                v-if="scope.row.mmse !== null">
                <!-- 这里是 popover 显示的内容 -->
                <p v-if="scope.row.mmseDirective !== null">MMSE_directive 分数: {{ scope.row.mmseDirective }}</p>
                <p v-else>MMSE_directive 分数: 无</p>
                <p v-if="scope.row.mmseMemory !== null">MMSE_memory 分数: {{ scope.row.mmseMemory }}</p>
                <p v-else>MMSE_memory分数: 无</p>
                <p v-if="scope.row.mmseAttention !== null">MMSE_attention 分数: {{ scope.row.mmseAttention }}</p>
                <p v-else>MMSE_attention分数: 无</p>
                <p v-if="scope.row.mmseLanguage !== null">MMSE_language 分数: {{ scope.row.mmseLanguage }}</p>
                <p v-else>MMSE_language分数: 无</p>
                <p v-if="scope.row.mmseRecall !== null">MMSE_recall 分数: {{ scope.row.mmseRecall }}</p>
                <p v-else>MMSE_recall分数: 无</p>

                <!-- 显示的目标元素 -->
                <p slot="reference" class="bbb">{{ scope.row.mmse }}</p>
              </el-popover>
            </template>
            <span v-else class="aaa">未填写</span>
          </template>
        </el-table-column>
        <el-table-column label="MOCA总分" align="center" prop="moca" min-width="100">
          <template slot-scope="scope">
            <template v-if="scope.row.moca !== null">
              <!-- 使用 el-popover 包裹住 moca 的值 -->
              <el-popover
                trigger="hover"
                placement="top-start"
                width="200"
                v-if="scope.row.moca !== null">
                <!-- 这里是 popover 显示的内容 -->
                <p v-if="scope.row.moca1 !== null">MOCA1分数: {{ scope.row.moca1 }}</p>
                <p v-else>MOCA1分数: 无</p>
                <p v-if="scope.row.moca2 !== null">MOCA2分数: {{ scope.row.moca2 }}</p>
                <p v-else>MOCA2分数: 无</p>
                <p v-if="scope.row.moca3 !== null">MOCA3分数: {{ scope.row.moca3 }}</p>
                <p v-else>MOCA3分数: 无</p>
                <p v-if="scope.row.moca4 !== null">MOCA4分数: {{ scope.row.moca4 }}</p>
                <p v-else>MOCA4分数: 无</p>
                <p v-if="scope.row.moca5 !== null">MOCA5分数: {{ scope.row.moca5 }}</p>
                <p v-else>MOCA5分数: 无</p>
                <p v-if="scope.row.moca6 !== null">MOCA6分数: {{ scope.row.moca6 }}</p>
                <p v-else>MOCA6分数: 无</p>
                <p v-if="scope.row.moca7 !== null">MOCA7分数: {{ scope.row.moca7 }}</p>
                <p v-else>MOCA7分数: 无</p>
                <p v-if="scope.row.moca8 !== null">MOCA8分数: {{ scope.row.moca8 }}</p>
                <p v-else>MOCA8分数: 无</p>

                <!-- 显示的目标元素 -->
                <p slot="reference" class="bbb">{{ scope.row.moca }}</p>
              </el-popover>
            </template>
            <span v-else class="aaa">未填写</span>
          </template>
        </el-table-column>


        <!--          <el-table-column label="MOCA1分数" align="center" prop="moca1" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca1 !== null" class="bbb">{{ scope.row.moca1 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA2分数" align="center" prop="moca2" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca2 !== null" class="bbb">{{ scope.row.moca2 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA3分数" align="center" prop="moca3" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca3 !== null" class="bbb">{{ scope.row.moca3 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA4分数" align="center" prop="moca4" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca4 !== null" class="bbb">{{ scope.row.moca4 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA5分数" align="center" prop="moca5" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca5 !== null" class="bbb">{{ scope.row.moca5 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA6分数" align="center" prop="moca6" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca6 !== null" class="bbb">{{ scope.row.moca6 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA7分数" align="center" prop="moca7" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca7 !== null" class="bbb">{{ scope.row.moca7 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA8分数" align="center" prop="moca8" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca8 !== null" class="bbb">{{ scope.row.moca8 }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <!--          <el-table-column label="MOCA总分" align="center" prop="moca" min-width="100">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span v-if="scope.row.moca !== null" class="bbb">{{ scope.row.moca }}</span>-->
        <!--              <span v-else class="aaa">未填写</span>-->
        <!--            </template>>-->
        <!--          </el-table-column>-->
        <el-table-column label="CDT分数" align="center" prop="cdt" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.cdt !== null" class="bbb">{{ scope.row.cdt }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_1分数" align="center" prop="avltN1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN1 !== null" class="bbb">{{ scope.row.avltN1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_2分数" align="center" prop="avltN2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN2 !== null" class="bbb">{{ scope.row.avltN2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_3分数" align="center" prop="avltN3" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN3 !== null" class="bbb">{{ scope.row.avltN3 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_4分数" align="center" prop="avltN4" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN4 !== null" class="bbb">{{ scope.row.avltN4 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_5分数" align="center" prop="avltN5" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN5 !== null" class="bbb">{{ scope.row.avltN5 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_6分数" align="center" prop="avltN6" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN6 !== null" class="bbb">{{ scope.row.avltN6 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AVLT_7分数" align="center" prop="avltN7" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.avltN7 !== null" class="bbb">{{ scope.row.avltN7 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="TMT_1A分数" align="center" prop="tmt1a" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.tmt1a !== null" class="bbb">{{ scope.row.tmt1a }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="TMT_1B分数" align="center" prop="tmt1b" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.tmt1b !== null" class="bbb">{{ scope.row.tmt1b }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="TMT_2A分数" align="center" prop="tmt2a" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.tmt2a !== null" class="bbb">{{ scope.row.tmt2a }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="TMT_2B分数" align="center" prop="tmt2b" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.tmt2b !== null" class="bbb">{{ scope.row.tmt2b }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="DST1分数" align="center" prop="dst1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.dst1 !== null" class="bbb">{{ scope.row.dst1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="DST2分数" align="center" prop="dst2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.dst2 !== null" class="bbb">{{ scope.row.dst2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_A1分数" align="center" prop="vftA1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftA1 !== null" class="bbb">{{ scope.row.vftA1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_A2分数" align="center" prop="vftA2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftA2 !== null" class="bbb">{{ scope.row.vftA2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_B1分数" align="center" prop="vftB1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftB1 !== null" class="bbb">{{ scope.row.vftB1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_B2分数" align="center" prop="vftB2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftB2 !== null" class="bbb">{{ scope.row.vftB2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_C1分数" align="center" prop="vftC1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftC1 !== null" class="bbb">{{ scope.row.vftC1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="VFT_C2分数" align="center" prop="vftC2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.vftC2 !== null" class="bbb">{{ scope.row.vftC2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="HAMD分数" align="center" prop="hamd" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.hamd !== null" class="bbb">{{ scope.row.hamd }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="HAMA分数" align="center" prop="hama" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.hama !== null" class="bbb">{{ scope.row.hama }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="ADL分数" align="center" prop="adl" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.adl !== null" class="bbb">{{ scope.row.adl }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="PSQI分数" align="center" prop="psqi" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.psqi !== null" class="bbb">{{ scope.row.psqi }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="NPI1分数" align="center" prop="npi1" min-width="100">

          <template slot-scope="scope">
            <span v-if="scope.row.npi1 !== null" class="bbb">{{ scope.row.npi1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>

        <el-table-column label="NPI2分数" align="center" prop="npi2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.npi2 !== null" class="bbb">{{ scope.row.npi2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="AQD1分数" align="center" prop="aqd1" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.aqd1 !== null" class="bbb">{{ scope.row.aqd1 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>
        </el-table-column>
        <el-table-column label="AQD2分数" align="center" prop="aqd2" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.aqd2 !== null" class="bbb">{{ scope.row.aqd2 }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="HIS分数" align="center" prop="his" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.his !== null" class="bbb">{{ scope.row.his }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <el-table-column label="GDS分数" align="center" prop="gds" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.gds !== null" class="bbb">{{ scope.row.gds }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>


        <el-table-column label="CFT分数" align="center" prop="CFT" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.cft !== null" class="bbb">{{ scope.row.cft }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>

        <el-table-column label="CDR分数" align="center" prop="cdr" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.cdr !== null" class="bbb">{{ scope.row.cdr }}</span>
            <span v-else class="aaa">未填写</span>
          </template>>
        </el-table-column>
        <!--          <el-table-column label="患病概率" align="center" min-width="100" fixed="right">-->
        <!--            <template slot-scope="scope">-->
        <!--              <span class="bbb">{{ (Math.random() * 0.1).toFixed(2) }}</span>-->
        <!--            </template>-->
        <!--          </el-table-column>-->


        <!--          <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" :width="140" >-->
        <!--            <template slot-scope="scope">-->
        <!--              <el-button-->
        <!--                v-show="!listEmpty"-->
        <!--                fixed="right"-->
        <!--                size="mini"-->
        <!--                type="text"-->
        <!--                icon="el-icon-edit"-->
        <!--                @click="handleUpdateUser(scope.row, scope.$index)"-->
        <!--              >修改被试用户信息</el-button>-->
        <!--            </template>-->
        <!--          </el-table-column>-->
        <!--            <el-table-column label="量表确认" align="center" fixed="right" class-name="small-padding fixed-width" :width="120" >-->
        <!--              <template slot-scope="scope">-->
        <!--                <el-button-->
        <!--                  v-show="!listEmpty"-->
        <!--                  fixed="right"-->
        <!--                  size="mini"-->
        <!--                  type="text"-->
        <!--                  icon="el-icon-finished"-->
        <!--                  :class="{'red-button': !isConfirmed(scope.row), 'green-button': isConfirmed(scope.row)}"-->
        <!--                  @click="handleUpdateLiangbiao(scope.row, scope.$index)">-->
        <!--                  {{ isConfirmed(scope.row) ? '量表数据已确认' : '量表数据待确认' }}-->
        <!--                </el-button>-->
        <!--              </template>-->
        <!--            </el-table-column>-->
        <!--            <el-table-column label="编号确认" align="center" fixed="right" class-name="small-padding fixed-width" :width="120" >-->
        <!--              <template slot-scope="scope">-->
        <!--                <el-button-->
        <!--                  v-show="!listEmpty"-->
        <!--                  fixed="right"-->
        <!--                  size="mini"-->
        <!--                  type="text"-->
        <!--                  icon="el-icon-finished"-->
        <!--                  :class="{'red-button': !isConfirmed1(scope.row), 'green-button': isConfirmed1(scope.row)}"-->
        <!--                  @click="changeTestId(scope.row, scope.$index)">-->
        <!--                  {{ isConfirmed1(scope.row) ? '测试编号已确认' : '测试编号待确认' }}-->
        <!--                </el-button>-->
        <!--              </template>-->
        <!--            </el-table-column>-->


        <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" :width="200">
          <template slot-scope="scope">
            <div>
              <!-- 编辑按钮 -->
              <el-button
                v-show="!listEmpty"
                size="mini"
                type="text"
                @click="handleUpdateUser(scope.row, scope.$index)"
                class="blue-button"
              >
                用户信息
              </el-button>

              <!-- 删除按钮 -->
              <el-button
                v-show="!listEmpty"
                size="mini"
                type="text"
                @click="handleUpdateLiangbiao(scope.row, scope.$index)"
                class="green-button"
              >
                量表数据
              </el-button>

              <!-- 下载按钮 -->
              <el-button
                v-show="!listEmpty"
                size="mini"
                type="text"
                @click="changeTestId(scope.row, scope.$index)"
                class="orange-button"
              >
                被试编号
              </el-button>

              <!-- 暂时删除按钮 -->
              <el-button
                v-show="!listEmpty"
                size="mini"
                type="text"
                @click="DeleteChart(scope.row.testId, scope.$index)"
                class="red-button"
              >
                删除
              </el-button>
            </div>
          </template>
        </el-table-column>




      </el-table>
      <pagination

        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @prev-click="prevfun"
        @next-click="nextfun"
        @pagination="getList"
      />

    </div>




    <!--    <pagination

          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @prev-click="prevfun"
          @next-click="nextfun"
          @pagination="getList"
        />-->


    <!-- 添加或修改【请填写功能名称】对话框 -->



    <el-dialog :visible.sync="open2" width="1800px" append-to-body >
      <template slot="title">
        <div style="font-size:30px;color:#000000;font-weight: bold;font-family: “仿宋”;height: 10px">修改被试用户信息</div>
      </template>

      <el-button
        size="mini"
        type="text"
        icon="el-icon-download"
        @click="downloadpdf(totalList[cur_row])"
      >下载PDF</el-button>
      <el-button
        size="mini"
        type="text"
        icon="el-icon-download"
        @click="downloadexcel(totalList[cur_row])"
      >下载具体分数表</el-button>
      <el-button
        size="mini"
        type="text"
        icon="el-icon-download"
        @click="downloadReport(totalList[cur_row])"
      >下载报告</el-button>
      <el-row>
        <el-col :span="12">
          <img :src="getImgSrc(cur_row, 'base_1_55238')" style="width: 100%; height: auto;">
        </el-col>
        <el-col :span="12">
          <el-form :model="form2" ref="form" :rules="rules2" label-position="left" label-width="80px"
                   size="default" @submit.native.prevent class="right-section" style="width: 100%;" >
            <div class="static-content-item">
              <el-divider direction="horizontal"></el-divider>
            </div>
            <el-row>
              <el-col :span="4" class="grid-cell-new">
                <div class="static-content-item" style="float: left">
                  <div>姓 名：</div>
                </div>
              </el-col>
              <el-col :span="4" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="name">
                  <el-input @input="changeVersion" v-model="form2.name" placeholder="请输入姓名" type="text"  clearable></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="7" class="grid-cell" style="float: right">
                <el-form-item label="" label-width="0px" prop="sex">
                  <el-radio-group v-model="form2.sex">
                    <el-radio label="男">男</el-radio>
                    <el-radio label="女">女</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="4" class="grid-cell-new" style="float: right">
                <div class="static-content-item" >
                  <div >性 别：</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5" class="grid-cell-new">
                <div class="static-content-item">
                  <div>出生日期：</div>
                </div>
              </el-col>
              <el-col :span="2" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="dataOfBorn" class="label-center-align">
                  <el-date-picker
                    v-model="form2.dateOfBorn"
                    type="date"
                    class="full-width-input"
                    value-format="yyyy-MM-dd"
                    clearable
                    default-value="1960-06-01"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="10" class="grid-cell" style="float: right">
                <el-form-item label="" label-width="0px" prop="hand">
                  <el-radio-group v-model="form2.hand">
                    <el-radio :label="'左手'" style="margin-left: 50px;">左手</el-radio>
                    <el-radio :label="'右手'">右手</el-radio>
                    <el-radio :label="'其他'">其他</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="4" class="grid-cell-new" style="float: right">
                <div class="static-content-item" style="margin-left: 50px">
                  <div>惯 用 手：</div>
                </div>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="5" class="grid-cell-new">
                <div class="static-content-item">
                  <div>联 系 人：</div>
                </div>
              </el-col>
              <el-col :span="4" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="contact">
                  <el-input placeholder="请输入联系人" @input="changeVersion" v-model="form2.contact" type="text" clearable></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="7" class="grid-cell" style="float: right">
                <el-form-item label="" label-width="0px" prop="tel">
                  <el-input placeholder="请输入联系方式" @input="changeVersion" v-model="form2.tel" type="text" clearable></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5" class="grid-cell-new" style="float: right">
                <div class="static-content-item">
                  <div>联系方式：</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5" class="grid-cell-new">
                <div class="static-content-item">
                  <div>家 庭 住 址：</div>
                </div>
              </el-col>
              <el-col :span="10" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="patientNumber">
                  <el-input placeholder="请输入家庭住址" @input="changeVersion" v-model="form2.patientNumber" type="text" clearable></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="5" class="grid-cell-new">
                <div class="static-content-item" >
                  <div  style="float: left">婚姻情况：</div>
                </div>
              </el-col>
              <el-col :span="18" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="marry">
                  <el-radio-group v-model="form2.marry">
                    <el-radio :label="'已婚'" style="margin-right: 40px; margin-top: 20px; margin-left: 50px;">已婚</el-radio>
                    <el-radio :label="'未婚'" style="margin-right: 40px; margin-top: 20px;">未婚</el-radio>
                    <el-radio :label="'丧偶'" style="margin-right: 40px; margin-top: 20px;">丧偶</el-radio>
                    <el-radio :label="'离异'" style="margin-right: 40px; margin-top: 20px;">离异</el-radio>
                    <el-radio :label="'其他'">其他</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>

            </el-row>
            <el-row>
              <el-col :span="4" class="grid-cell-new">
                <div class="static-content-item">
                  <div>受教育程度：</div>
                </div>
              </el-col>
              <el-col :span="18" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="edu">
                  <el-radio-group v-model="form2.edu" style="margin-left: 50px;">
                    <el-radio :label="'文盲和半文盲'">文盲和半文盲</el-radio>
                    <el-radio :label="'小学'">小学</el-radio>
                    <el-radio :label="'初中'">初中</el-radio>
                    <el-radio :label="'高中'">高中</el-radio>
                    <el-radio :label="'本科'">本科</el-radio>
                    <el-radio :label="'研究生'">研究生</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6" class="grid-cell-new">
                <div class="static-content-item">
                  <div>正规学校教育年份共:</div>
                </div>
              </el-col>
              <el-col :span="3" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="eduYears">
                  <el-input-number v-model="form2.eduYears" class="full-width-input" controls-position="right"
                                   :min="-100000000000" :max="100000000000" :precision="0" :step="1"></el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="12" class="grid-cell-tmp">
                <div class="static-content-item">
                  <div>年</div>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="7" class="grid-cell-new">
                <div class="static-content-item">
                  <div>痴呆家族史</div>
                </div>
              </el-col>
              <el-col :span="14" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="familyHistory">
                  <el-radio-group v-model="form2.familyHistory">
                    <el-radio :label="'有'">有</el-radio>
                    <el-radio :label="'无'">无</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="7" class="grid-cell-new">
                <div class="static-content-item">
                  <div>家族史成员与患者关系：</div>
                </div>
              </el-col>
              <el-col :span="14" class="grid-cell">
                <el-form-item label="" label-width="0px" prop="contact">
                  <el-input placeholder="请输入家族史成员与患者关系" @input="changeVersion" v-model="form2.familyHistory" type="text" clearable></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <div class="static-content-item"
              >主诉及体检情况</div>
              <textarea style="width:800px;height: 700px"></textarea>
            </el-row>

          </el-form>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm2">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>

    </el-dialog>

    <el-dialog :visible.sync="open3" width="850px" append-to-body>
      <template slot="title">
        <div style="font-size:30px;color:#000000;font-weight: bold;font-family: “仿宋”;height: 10px">修改电子量表数据</div>
      </template>
      <el-form :model="form3" ref="form3" label-position="left" label-width="80px" size="default">
        <div class="static-content-item">
          <el-divider direction="horizontal"></el-divider>
        </div>
        <el-row v-for="(key, index) in change_attrs" :key="index" class="row" :gutter="80">
          <el-col :span="5" class="grid-cell-new">
            <div class="static-content-item">
              <div>{{ mp[key] }}: </div>
            </div>
          </el-col>
          <el-col :span="6" class="grid-cell-new">
            <el-input :placeholder="`${totalList[cur_row][key]}`" @input="change5" v-model="form[key]" type="text" clearable></el-input>
          </el-col>
          <el-col :span="4" class="grid-cell">
            <img :src="getImgSrc(cur_row, key)" class="img32" onerror="this.style.display='none'"/>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">

        <el-button type="primary" @click="submitForm(totalList[cur_row]['id'])">确 定</el-button>
        <el-button @click="cancel3">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="open4" width="850px" append-to-body>
      <template slot="title">
        <div style="font-size:30px;color:#000000;font-weight: bold;font-family: “仿宋”;height: 10px">修改测试编号</div>
      </template>
      <el-form :model="form3" ref="form3" label-position="left" label-width="80px" size="default">
        <div class="static-content-item">
          <el-divider direction="horizontal"></el-divider>
        </div>
        <el-row v-for="(key, index) in change_attrs2" :key="index" class="row" :gutter="80">
          <el-col :span="5" class="grid-cell-new">
            <div class="static-content-item">
              <div>{{ mp[key] }}: </div>
            </div>
          </el-col>
          <el-col :span="6" class="grid-cell-new">
            <el-input :placeholder="`${totalList[cur_row][key]}`" @input="change5" v-model="form[key]" type="text" clearable></el-input>
          </el-col>
          <el-col :span="4" class="grid-cell">
            <img :src="getImgSrc(cur_row, key)" class="img33" onerror="this.style.display='none'"/>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">

        <el-button type="primary" @click="submitForm25(totalList[cur_row]['id'])">确 定</el-button>
        <el-button @click="cancel4">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {
  defineComponent,
  toRefs,
  reactive,
  getCurrentInstance
}
  from 'vue'
import $ from 'jquery'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import {
  listCutAreas,
  listTotal,
  getTotal,
  addTotal,
  updateTotal,
  getTotaluser,
  updateTotaluser, downloadsr, getscrid, handleDeleteChart
} from '@/api/system/totalv2'
import api from "js-cookie";
import {red} from "chalk";

import table2excel from 'js-table2excel'
import * as XLSX from 'xlsx';

import axios from "axios";

function exportExcel1(exportList) {
  // 创建一个新的工作簿
  const wb = XLSX.utils.book_new();

  // 将数据转换为工作表
  const ws = XLSX.utils.json_to_sheet(exportList);

  // 将工作表添加到工作簿
  XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');

  // 生成Excel文件的Blob对象
  const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'binary' });

  // 将二进制字符串转换为字符数组
  function s2ab(s) {
    const buf = new ArrayBuffer(s.length);
    const view = new Uint8Array(buf);
    for (let i = 0; i < s.length; i++) {
      view[i] = s.charCodeAt(i) & 0xFF;
    }
    return buf;
  }

  // 创建Blob对象
  const blob = new Blob([s2ab(wbout)], { type: 'application/octet-stream' });

  // 返回Blob对象
  return blob;
}


export default {
  name: "Total",
  data() {
    return {
      htmlTitle: "测试导出文件",
      listEmpty: false,
      mp1: {'testId':'编号','patientNumber':'门诊号','contact':'联系人','tel':'联系方式','name': '姓名', 'date': '时间', 'location': '地点','sex':'性别','age':'年龄','edu':'受教育程度','familyHistory':'家族史', 'mmseDirective':'MMSE_directive分数', 'mmseMemory':'MMSE_memory分数','mmseAttention':'MMSE_attention分数','mmseRecall':'MMSE_recall分数','mmseLanguage':'MMSE_language分数', 'mmse':'MMSE总分','moca1':'MOCA1分数','moca2':'MOCA2分数','moca3':'MOCA3分数','moca4':'MOCA4分数','moca5':'MOCA5分数','moca6':'MOCA6分数','moca7':'MOCA7分数','moca8':'MOCA8分数', 'moca':'MOCA总分','npi1': 'NPI1分数', 'npi2': 'NPI2分数', 'adl': 'ADL分数', 'cdr': 'CDR分数', 'aqd1': 'AQD1分数', 'dst1': 'DST1分数', 'dst2': 'DST2分数',  'avltN1':'AVLT_1分数','avltN2':'AVLT_2分数', 'avltN3': 'AVLT-3分数', 'avltN4':'AVLT-4分数','avltN5':'AVLT-5分数','avltN6':'AVLT_6分数','avltN7':'AVLT_7分数','hamd':'HAMD分数','hama':'HAMA分数', 'tmt1a': 'TMT_1A分数', 'tmt1b': 'TMT_1B分数', 'tmt2a': 'TMT_2A分数', 'tmt2b': 'TMT_2B分数', 'his': 'HIS分数', 'gds': 'GDS分数', 'psqi': 'PSQI分数', 'cft': 'CFT分数', 'scds': 'SCDS分数', 'CFT': 'CFT分数', 'aqd2': 'AQD2分数', 'cdt': 'CDT分数', 'vftA1': 'VFT_A1分数', 'vftA2': 'VFT_A2分数', 'vftB1': 'VFT_B1分数', 'vftB2': 'VFT_B2分数', 'vftC1': 'VFT_C1分数', 'vftC2': 'VFT_C2分数'},
      mp: {
        'mmseDirective':'MMSE_directive',
        'mmseMemory':'MMSE_memory',
        'mmseAttention':'MMSE_attention',
        'mmseRecall':'MMSE_recall',
        'mmseLanguage':'MMSE_language',
        'moca1':'MOCA1',
        'moca2':'MOCA2',
        'moca3':'MOCA3',
        'moca4':'MOCA4',
        'moca5':'MOCA5',
        'moca6':'MOCA6',
        'moca7':'MOCA7',
        'moca8':'MOCA8',

        'avltN1':'AVLT_1',
        'avltN2':'AVLT_2',
        'avltN3': 'AVLT-3',
        'avltN4':'AVLT-4',
        'avltN5':'AVLT-5',
        'avltN6':'AVLT_6',
        'avltN7':'AVLT_7',
        'hamd':'HAMD',
        'hama':'HAMA',
        "tmt1a":"TMT1A",
        "tmt1b":"TMT1B",
        "tmt2a":"TMT2A",
        "tmt2b":"TMT2B",
        "scds":"SCDS",
        "vftA1":"VFTA1",
        "vftA2":"VFTA2",
        "vftB1":"VFTB1",
        "vftB2":"VFTB2",
        "vftC1":"VFTC1",
        "vftC2":"VFTC2",
        "mmse":"MMSE",
        "cdt":"CDT",
        "cdr":"CDR",
        "his":"HIS",
        "psqi":"PSQI",
        "cft":"CFT",
        "npi1":"NPI-1",
        "aqd1":"AQD1",
        "dst2":"DST-2",
        "aqd2":"AQD2",
        "gds":"GDS",
        "adl":"ADL",
        "moca":'MOCA',
        "npi2":"NPI-2",
        "dst1":"DST-1",
        "testId": "Test-id"
      },
      confirmedFlag: [],
      liangbiaoConfirmed: false,
      form3:{'avltN13': ''},
      dynamicColumns: [
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' },
        { prop: 'column3', label: '列3' },
        { prop: 'column4', label: '列4' }
        // 添加更多列
      ],
      images: [

      ],

      imageUrl: '',
      imageStyle: {
        'max-width': '100%',  // 设置最大宽度为100%
        'max-height': '100%'  // 设置最大高度为100%
      },
      options: [{
        value: 1,
        label: '男'
      }, {
        value: 0,
        label: '女'
      }],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      cur_row: 0,
      cut_areas: [],
      totalList: [],
      totalList_val: [],
      change_attrs1: ["testId","contact","tel","name", "date", "location", "sex","age","familyHistory","scds", "mmseDirective","mmseMemory","mmseAttention","mmseRecall","mmseLanguage","mmse","moca1",  "moca2","moca3","moca4","moca5","moca6","moca7","moca8","moca","cdt","avltN1","avltN2","avltN3", "avltN4", "avltN5", "avltN6","avltN7","tmt1a", "tmt1b", "tmt2a", "tmt2b", "dst1","dst2","vftA1", "vftA2", "vftB1", "vftB2", "vftC1","vftC2", "hama", "hamd", "adl", "psqi", "cft", "npi1","npi2","aqd1","aqd2" ,"his","gds","cft","cdr","dst2", "gds", "adl","cdr"],
      change_attrs: ["scds", "mmseDirective","mmseMemory","mmseAttention","mmseRecall","mmseLanguage","mmse","moca1",  "moca2","moca3","moca4","moca5","moca6","moca7","moca8","moca","cdt","avltN1","avltN2","avltN3", "avltN4", "avltN5", "avltN6","avltN7","tmt1a", "tmt1b", "tmt2a", "tmt2b", "dst1","dst2","vftA1", "vftA2", "vftB1", "vftB2", "vftC1","vftC2", "hama", "hamd", "adl", "psqi", "cft", "npi1","npi2","aqd1","aqd2" ,"his","gds","cft","cdr"],
      change_attrs2: ["testId"],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open2: false,
      open3: false,
      open4: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name:null,
        location:null
      },
      // 表单参数
      form: {},
      form2: {},
      // 表单校验
      rules: {
      },
      rules2: {
      },
      formData: {
        input85803: "请输入姓名",
        input58146: "请输入性别",
        input101264: "请输入年龄：",
        date22364: null,
        input50346: "请输入门诊号",
        input74202: "请输入联系方式",
        input51426: "请输入联系人",
        input70316: "请输入婚姻情况",
        input67297: "请输入惯用手",
        input91962: "请输入家庭住址",
        number113675: 0,
        input25036: "请输入痴呆家族史",
      },
    };
  },
  created() {
    this.getList();
    const state = reactive({
      formData: {
        input85803: "请输入姓名",
        input58146: "请输入性别",
        input101264: "请输入年龄：",
        date22364: null,
        input50346: "请输入门诊号",
        input74202: "请输入联系方式",
        input51426: "请输入联系人",
        input70316: "请输入婚姻情况",
        input67297: "请输入惯用手",
        input91962: "请输入家庭住址",
        number113675: 0,
        input25036: "请输入痴呆家族史",
      },
      rules: {},
    })
    const instance = getCurrentInstance()
    const submitForm = () => {
      instance.proxy.$refs['vForm'].validate(valid => {
        if (!valid) return
        //TODO: 提交表单
      })
    }
    const resetForm = () => {
      instance.proxy.$refs['vForm'].resetFields()
    }
    return {
      ...toRefs(state),
      submitForm,
      resetForm
    }
  },
  setup() {

  },
  mounted() {
    this.imgLoad();
    window.addEventListener('resize',() => {
      this.imgLoad();
    },false)
    this.$axios("navData/getInitData").then(result => {
      this.banner = result.data.bannerData
    })
  },
  computed: {

  },
  methods: {
    changeTestId(row, index){
      this.cur_row = index;
      const id = row.id || this.ids
      this.open4 = true
    },
    addClass({ row, column, rowIndex, columnIndex }){
      if(columnIndex === 1){
        return "re";
      }
    },
    isConfirmed(row){
      var p = 0;
      for(var i = 0;i < this.totalList.length;i++){
        if(this.totalList[i]["id"] == row.id){
          p = i;
          break;
        }
      }
      var num1 = this.totalList[p]["confirmed"] % 10;
      var num2 = Math.floor(this.totalList[p]["confirmed"] / 10);
      if(num2 === 1){
        return true;
      }
      else{
        return false;
      }
    },
    isConfirmed1(row){
      var p = 0;
      for(var i = 0;i < this.totalList.length;i++){
        if(this.totalList[i]["id"] == row.id){
          p = i;
          break;
        }
      }
      var num1 = this.totalList[p]["confirmed"] % 10;
      var num2 = Math.floor(this.totalList[p]["confirmed"] / 10);
      if(num1 === 1){
        return true;
      }
      else{
        return false;
      }
    },
    exportExcel() {
      $("#aTable").table2excel({
        exclude: ".noExl",
        sheetName: "导出文件",
        filename: "导出文件",
        exclude_img: true,
        exclude_links: true,
        exclude_inputs: true
      });
    },
    change5(){
      this.$forceUpdate();
    },
    getImgSrc(row_index, key){
      const id = this.totalList[row_index]["scrId"];
      var name;
      if (key == "avltN13") {
        name = "AVLT_N1_3 total";
      } else if (key == "avlt4") {
        name = "AVLTN4 total";
      } else if (key == "scds") {
        name = "SCDS total";
      } else if (key == "avlt5") {
        name = "AVLTN5 total";
      } else if (key == "tmt1a") {
        name = "TMT1A time";
      } else if (key == "tmt1b") {
        name = "TMT1B time";
      } else if (key == "tmt2a") {
        name = "TMT2A time";
      } else if (key == "tmt2b") {
        name = "TMT2B time";
      } else if (key == "vftA1") {
        name = "VFTA1 total";
      } else if (key == "vftA2") {
        name = "VFTA2 total";
      } else if (key == "vftB1") {
        name = "VFTB1 total";
      } else if (key == "vftB2") {
        name = "VFTB2 total";
      } else if (key == "vftC1") {
        name = "VFTC1 total";
      } else if (key == "vftC2") {
        name = "VFTC2 total";
      } else if (key == "base_1_55238") {
        name = `base_${id}_55246`;
      } else if (key == "testId"){
        name = "id"
      }
      else{
        return `http://caimi.bupt.edu.cn/api/scale/img/${id}/${name}.png`
      }
      // return `http://localhost:7051/${id}/${name}.png`
      return `http://caimi.bupt.edu.cn/api/scale/img/${id}/${name}.png`
    },
    formatDate(time) {
      if (time == null || time == "") return "";
      let date = new Date(time)
      let year = date.getFullYear()
      let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
      let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
      let hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
      let minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
      let seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
      return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
    },
    displayBackendData(data) {
      return data !== null ? data : '未填写';
    },




    /**调色**/
    changeVersion(newVersion){



    },
    cellStyle({ column, rowIndex }) {
      // 根据行数据或者行索引来判断是否需要变
      // if (this.totalList[rowIndex][column.property+'Level']==null)
      // {return "0", "color:#D1141F"}

      if(this.totalList==null||this.totalList.length==0){
        return {// 不需要变色时返回一个空对象
        }
      }
      else if (this.totalList[rowIndex][column.property+'Level'] == '正常') {
        return { background: '#129CFF' ,opacity: 0.8}; // 返回一个样式对象
      } else if (this.totalList[rowIndex][column.property+'Level']== '轻度认知障碍'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度认知障碍'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度认知障碍'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '极重度认知障碍'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度'){
        return  {background: '#0851ED',opacity:0.9}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度抑郁'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度抑郁'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度抑郁'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '无抑郁'){
        return  {background: '#129CFF' ,opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度血管性痴呆'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '血管性痴呆'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '可能血管性痴呆'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '老年性痴呆'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '左利手'){
        return  {background: ''}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '右利手'){
        return  {background: ''}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '双利手'){
        return  {background: ''}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '睡眠质量很差'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '睡眠质量一般'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property +'Level'] == '睡眠质量还行'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '睡眠质量很好'){
        return  {background: '#129CFF' ,opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '建议就医'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '认知功能正常'){
        return  {background: '#129CFF' ,opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度认知障碍'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度认知障碍'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level' ]== '重度认知障碍'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level' ]== '完全独立'){
        return  {background: '#0570E3',opacity:0.9}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '基本独立'){
        return  {background: '#129CFF' ,opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度依赖'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度依赖'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度依赖'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '完全依赖'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度痴呆'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度痴呆'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度痴呆'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '可疑痴呆'){
        return  {background: '#AADBEF',opacity: 0.7}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '健康'){
        return  {background: '#129CFF' ,opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '重度神经精神症状'){
        return  {background: '#D1141F',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '中度神经精神症状'){
        return  {background: '#ED6F49',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '轻度神经精神症状'){
        return  {background: '#E9BB95',opacity: 0.8}}
      else if (this.totalList[rowIndex][column.property+'Level'] == '无神经精神症状'){
        return  {background: '#129CFF' ,opacity: 0.8}}

      return {// 不需要变色时返回一个空对象
      }},
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listTotal(this.queryParams).then(response => {
        this.totalList = response.rows;
        for(var i = 0;i < this.totalList.length;i++){
          this.totalList_val.push([]);
          for(const key in this.totalList[i]){
            const value = this.totalList[i][key];
            if (this.change_attrs.includes(key)) {
              this.totalList_val[i][key] = value;
            }
          }
        }
        this.total = response.total;
        this.loading = false;
      });
      listCutAreas().then(response => {
        const res = response.rows;
        for(var i = 0;i < res.length;i++){
          // this.cut_areas.push(JSON.parse(res[i]["cutarea"]));
          const json0 = JSON.parse(res[i]["cutarea"]);
          this.cut_areas.push(json0);
        }
      });

    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel2() {
      this.open2 = false;
      this.reset2();
    },
    cancel3() {
      this.open3 = false;
      this.reset2();
    },
    cancel4() {
      this.open4 = false;
    },
    // 表单重置
    reset() {
      for(var i = 0;i < this.change_attrs.length;i++){
        const key = this.change_attrs[i];
        this.form[key] = '';
      }
      this.resetForm("form");
    },
    reset2() {
      this.form2 = {
        id: '',
        name: '',
        sex:'',
        dateOfBorn:'',
        patientNumber:'',
        tel:'',
        contact:'',
        address:'',
        marry: '',
        hand:'',
        edu:'',
        familyHistory:''
      };
      this.resetForm("form2");
    },
    rowClassName({ row }) {
      if (row.status === 0) {
        return 'warning-row'
      }
    },
    /** 搜索按钮操作 */
    /*     handleQuery() {
          // this.getList();
          listTotal(this.queryParams).then(response => {
            this.totalList = response.rows;
            var temp = [];
            for(var i = 0;i < this.totalList.length;i++){
              if(this.totalList[i]["name"] == this.queryParams.name&&this.queryParams.location==null){
                console.log("11111111111111111111111")
                console.log(this.totalList[i]);
                temp.push(this.totalList[i]);
              }
              else if(this.totalList[i]["location"] == this.queryParams.location&&this.queryParams.name==null){
                console.log("22222222222222222222222222222")
                console.log(this.totalList[i]);
                temp.push(this.totalList[i]);
              }
              else if(this.totalList[i]["location"] == this.queryParams.location||this.totalList[i]["name"] == this.queryParams.name){
                console.log("3333333333333333333333333333")
                console.log(this.totalList[i]);
                temp.push(this.totalList[i]);
              }
            }
            if(temp.length == 0){
              this.listEmpty = true;
              const temp1 = {};
              temp.push(temp1);
            }
            else{
              this.listEmpty = false;
            }
            this.totalList = temp;
          });

          this.queryParams.pageNum = 1;
          // this.queryParams.name = name1;
        }, */
    handleQuery() {
      this.getList();
    },

    DeleteChart(row, index){
      handleDeleteChart(row.testId, index);
      this.getList()
    },

    /** 重置按钮操作 */
    resetQuery() {
      // this.resetForm("queryForm");
      // this.handleQuery();

      this.getList();
      this.listEmpty = false;
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加【请填写功能名称】";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getTotal(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改电子量表数据";
      });
    },
    handleUpdateUser(row, index){

      const temp = ['54761', '54767', '54768'];
      for(var i = 0;i < temp.length;i++) {
        const paper_id = temp[i];
        const png_name = "base_" + this.totalList[index]["scrId"] + "_" + paper_id + ".png";
        // http://caimi.bupt.edu.cn/api/scale/img/${id}/${name}.png
        const img_url = `http://caimi.bupt.edu.cn/api/scale/img/${this.totalList[index]["scrId"]}/${png_name}`;
        this.images.push(img_url);
      }

      this.cur_row = index;
      this.reset2();
      const id = row.id || this.ids

      getscrid(id).then(res=>{
        this.imageUrl = res.msg
        getTotaluser(id).then(response => {
          this.form2 = response.data;
          this.open2 = true;
          this.title = "修改被试用户信息";
        });
      })
    },
    prevfun(value) {
      this.pageNum = value
      this. getList(value)
    },
    nextfun(value) {
      this.pageNum = value
      this. getList(value)
    },
    handleUpdateLiangbiao(row, row_index){
      if(this.liangbiaoConfirmed == true){
        alert('已确认，不可再修改!');
        return;
      }
      for(var i = 0;i < this.change_attrs.length;i++){

        const key = this.change_attrs[i];
        this.form[key] = "";
      }

      this.cur_row = row_index;
      this.reset();
      const id = row.id || this.ids

      getscrid(id).then(res=>{
        this.imageUrl = res.msg

        getTotaluser(id).then(response => {
          this.form2 = response.data;
          this.open3 = true;
          this.title = "修改电子量表";

        });
      })
    },
    downloadpdf(rows){
      let id = rows.scrId
      let type = 'pdf'
      let name = rows.name
      downloadsr({ id ,type}).then(res=>{
        const url = window.URL.createObjectURL(new Blob([res]));
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', name+"量表.pdf");
        document.body.appendChild(link);
        link.click();
      })
    },
    async downloadReport(rows) {
      try {
        // 发送GET请求，响应类型设置为blob
        let id = rows.scrId
        const response = await axios.get('http://82.156.79.113:5003//download', {
          params: {
            id: id
          },
          responseType: 'blob' // 确保响应类型为blob
        });

        // 创建一个Blob对象
        const blob = new Blob([response.data], { type: 'application/pdf' });
        const url = window.URL.createObjectURL(blob);

        // 创建一个下载链接
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', 'report.pdf'); // 设置下载文件名
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);

        // 释放URL对象
        window.URL.revokeObjectURL(url);
      } catch (error) {
        console.error('Error downloading report:', error);
      }
    },
    downloadexcel(row){
      let id = row.scrId
      let type = 'xlsx'
      let name = row.name
      downloadsr({ id ,type}).then(res=>{
        const url = window.URL.createObjectURL(new Blob([res]));
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', name+"量表.xlsx");
        document.body.appendChild(link);
        link.click();
      })
    },
    /** 提交按钮 */
    submitForm(id){
      var p = 0;
      for(var i = 0;i < this.totalList.length;i++){
        if(this.totalList[i]["id"] == id){
          p = i;
          break;
        }
      }
      var userResponse = confirm('你确定要执行这个操作吗？');
      if (userResponse) {
        // 用户点击了“确定”
        alert('操作已确认。');
        this.confirmedFlag.push(id);
      } else {
        // 用户点击了“取消”
        return;
        alert('操作已取消。');
      }
      var num1 = this.totalList[p]["confirmed"] % 10;
      var num2 = Math.floor(this.totalList[p]["confirmed"] / 10);
      var temp = 10 + num1;
      this.form["confirmed"] = temp;
      this.form["id"] = id;
      updateTotal(this.form).then(response => {
        this.$modal.msgSuccess("修改成功");
        this.open = false;
        this.getList();
      });
    },
    submitForm25(id){
      var p = 0;
      for(var i = 0;i < this.totalList.length;i++){
        if(this.totalList[i]["id"] == id){
          p = i;
          break;
        }
      }
      var userResponse = confirm('你确定要执行这个操作吗？');
      if (userResponse) {
        // 用户点击了“确定”
        alert('操作已确认。');
        this.confirmedFlag.push(id);
      } else {
        // 用户点击了“取消”
        return;
        alert('操作已取消。');
      }
      var num1 = this.totalList[p]["confirmed"] % 10;
      var num2 = Math.floor(this.totalList[p]["confirmed"] / 10);
      var temp = num2 * 10 + 1;
      this.form["confirmed"] = temp;
      this.form["id"] = id;
      updateTotal(this.form).then(response => {
        this.$modal.msgSuccess("修改成功");
        this.open = false;
        this.getList();
      });
    },
    submitForm5() {

      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateTotal(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTotal(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    submitForm2() {

      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form2.id != null) {
            updateTotaluser(this.form2).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open2 = false;
              this.getList();
            });
          }
        }
      });
    },
    calculateAge(dateOfBirthString) {
      const birthday = new Date(dateOfBirthString);
      const today = new Date();

      let age = today.getFullYear() - birthday.getFullYear();
      const m = today.getMonth() - birthday.getMonth();

      // 如果当前月份还没有达到出生月份，或者月份相同但是当前日期还没有达到出生日期，年龄应减一
      if (m < 0 || (m === 0 && today.getDate() < birthday.getDate())) {
        age--;
      }

      return age;
    },
    /** 导出按钮操作 */
    handleExport() {
      // this.outToExcel.exportExcel(this.totalList);
      const tempSize = this.queryParams.pageSize;
      this.queryParams.pageSize = 100000000;
      listTotal(this.queryParams).then(response => {
        var flag = 0;
        var orgList = response.rows;
        var exportList = [];
        const res_user = [];
        let item = [];
        for(var i = 0;i < orgList.length;i++){
          var item1 = {};
          for(var j = 0;j < this.change_attrs1.length;j++){
            try{
              var attr = this.change_attrs1[j];
              item1[this.mp1[attr]] = orgList[i][attr];
            } catch(error) {

            }
          }
          item.push(item1);
        }
        for(var i = 0;i < orgList.length;i++){
          getTotaluser(orgList[i]['id']).then(response1 => {
            res_user.push(response1.data);
          });
        }
        setTimeout(() => {

          for(var i = 0;i < orgList.length;i++){
            item[i][this.mp1['sex']] = res_user[i]['sex']
            item[i][this.mp1['contact']] = res_user[i]['contact']
            item[i][this.mp1['tel']] = res_user[i]['tel']
            item[i][this.mp1['age']] = this.calculateAge(res_user[i]['dateOfBorn'])
            item[i][this.mp1['edu']] = res_user[i]['edu']
            item[i][this.mp1['familyHistory']] = res_user[i]['familyHistory']
            // exportList.push(item);
          }
          exportList = item;

          // return;
          const excelBlob = exportExcel1(exportList);
          // 创建一个下载链接
          const downloadUrl = window.URL.createObjectURL(excelBlob);
          const a = document.createElement('a');
          a.href = downloadUrl;
          a.download = 'data.xlsx';
          document.body.appendChild(a);
          a.click();
          document.body.removeChild(a);
          window.URL.revokeObjectURL(downloadUrl);
        }, 1000);
      });
      this.queryParams.pageSize = tempSize;
    }

  }
};
</script>

<style lang="scss">
body {
  font-family: 'SimHei', '黑体', sans-serif; /* 使用宋体字体 */
}

.orange-button {
  color: orange;
}
.red-button {
  color: red; /* 或者 background-color: red; 根据你的设计 */
}
.green-button {
  color: green; /* 或者 background-color: green; */
}
.img32 {
  width: 300px;   /* 图片宽度将是其父元素宽度的50% */
  height: 50px; /* 高度会自动调整以保持图片的原始宽高比 */
}
.img33 {
  width: auto;   /* 图片宽度将是其父元素宽度的50% */
  height: 25px; /* 高度会自动调整以保持图片的原始宽高比 */
}
.el-input-number.full-width-input,
.el-cascader.full-width-input {
  width: 100% !important;
}

.el-form-item--medium {
  .el-radio {
    line-height: 36px !important;
  }

  .el-rate {
    margin-top: 8px;
  }
}
.bbb{
  color: hsla(0, 0%, 0%, 1);
  fontFamily: "Times New Roman";
  font-weight: bold;
  height: 100%;
  width: 100%;

}
.el-form-item--small {
  .el-radio {
    line-height: 32px !important;
  }

  .el-rate {
    margin-top: 6px;
  }
}

.el-form-item--mini {
  .el-radio {
    line-height: 28px !important;
  }

  .el-rate {
    margin-top: 4px;
  }
}

.clear-fix:before,
.clear-fix:after {
  display: table;
  content: "";
}

.clear-fix:after {
  clear: both;
}
.table-container .el-table__body-wrapper {
  overflow-x: auto;
}
.float-right {
  float: right;
}

.aaa{

  font-weight: bold;
}
</style>

<style lang="scss" scoped>
div.table-container {
  table.table-layout {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;

    td.table-cell {
      display: table-cell;
      height: 36px;
      border: 1px solid #e1e2e3;
    }
  }
  .ccc{
    background-color: #657fa9;
  }
}

div.tab-container {}

.label-left-align ::v-deep .el-form-item__label {
  text-align: left;
}

.label-center-align ::v-deep .el-form-item__label {
  text-align: center;
}

.label-right-align ::v-deep .el-form-item__label {
  text-align: right;
}

.custom-label {}

.static-content-item {
  min-height: 20px;
  display: flex;
  align-items: center;
  font-size:18px;
  font-family:宋体;
  text-align: center;
  ::v-deep .el-divider--horizontal {
    margin: 0;
  }
}
.grid-cell-new {
  padding-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.grid-cell-tmp{
  padding-top: 10px;
}

::v-deep .el-table__header-wrapper th.re{
  background-color: #657fa9;
}
.dialog-content {
  display: flex;
}

.left-section {
  flex: 1;
}

.right-section {
  flex: 1;
}

</style>
